//Page Object
// 引用用来发送请求的方法
import { request } from '../../api/index.js'
import regeneratorRuntime from '../../lib/runtime/runtime';
Page({
  data: {
    swiperList: [],
    cateList:[],
    foolList:[]
  },
  //options(Object)
  onLoad: function (options) {
    this.getSwiperImg(),
      this.getCateList(),
      this.getFloorList()
  },
  // 轮播图数据
  async getSwiperImg() {
    // request({ url: "/home/swiperdata" })
    //   .then((res) => {
    //     const {data} = res;
    //     console.log(data); 
    //   })
    let { data: res } = await request({ url: "/home/swiperdata" });
    this.setData({
      swiperList: res.message
    })
  },

  // 导航数据
  async getCateList() {
    const {data:res} = await request({ url: '/home/catitems' })
    // console.log(res);
    this.setData({
      cateList:res.message
    })
  },
  // 楼层数据
  async getFloorList(){
    const { data: res } = await request({ url:"/home/floordata"});
    console.log(res);
    this.setData({
      foolList: res.message
    })
  }
});
